﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.IO;
 
namespace YWJiXiao.App.WebForm.AdminManage.Pages
{
    public partial class Mail : BaseAdminPage
    {
       
        protected void Page_Load(object sender, EventArgs e)
        {
            

           

        }


        /// <summary>
        /// 初始化事件
        /// </summary>
        public void initEvent()
        {
            this.btnSaveTemp.Click += new EventHandler(btnSaveTemp_Click);
            this.btnSendEmail.Click += new EventHandler(btnSendEmail_Click);
        }

        /// <summary>
        /// 保存模板
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnSaveTemp_Click(object sender, EventArgs e)
        {
            string emailTemplateV = this.textEamilTemplate.InnerText;
            string path = AppDomain.CurrentDomain.BaseDirectory + "template/CompleteAllEvalNotice.htm";

            StreamWriter sw = new StreamWriter(path, false, System.Text.Encoding.UTF8);
            sw.WriteLine(emailTemplateV);
            sw.Close();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script>layer.msg('模板保存成功');</script>", false);

        }

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnSendEmail_Click(object sender, EventArgs e)
        {
            //   return;
            /*
             Guid stageid = JiXiaoContext.CurrentEvaluateStage.Gid;
             List<Employee> list = empService.GetAllEmployeeSendMail(stageid);//得到当前期间所有员工
             Employee emp = new Employee();

             MailService.SendBatch(emp, list, CurrentSetUpStage);
             * *
             */
          
               

            // MailService.SendAll("[测试邮件]", textEamilTemplate.Value, allJoin, CurrentSetUpStage);
        }
    }
}